import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
    routes: [
        {
            //设定默认路由
            path: '/',
            redirect: '/index'
        },
        {
            path: '/login',
            name: 'Login',
            component: () => import('../views/Login') //使用箭头函数(相当于懒汉模式)，提高使用效率
        },
        {
            path: '/index',
            name: 'Index',
            component: () => import('../views/Index'),
            children: [
                {
                    path: 'users',//子路由中开头不可以添加 /
                    name: 'Users',
                    component: () => import('../views/user/Index')
                }
            ]
        }
    ]
})
